package model;

import java.awt.Color;

public class PrescriptionLabel extends PrescriptionObject{
	//TODO: figure out what methods could be moved from PrescriptionBox to PrescriptionObject
	

	private int height;
	private int width;
	private boolean isResizing;
	private String placeholder;

	public PrescriptionLabel(int x, int y,int height, int width, Color lineColour, float lineWidth,
			String name, Color fillColour, Color textColour) {
		super(x, y, lineColour, lineWidth, fillColour, textColour);
		this.height = height;
		this.width = width;
		super.setName(name);
		
		isResizing = false;
		
		updateResizePoints();
		
	}

	public PrescriptionLabel(){
		this(Constants.DEFAULT_X,
				Constants.DEFAULT_Y,
				Constants.DEFAULT_HEIGHT,
				Constants.DEFAULT_WIDTH,
				Constants.DEFAULT_LINE_COLOUR, //want to be same colour as prescription so gives the feel of no line colour
				0.0f, 
				"",
				Constants.DEFAULT_FILL_COLOUR,//want to be same colour as prescription so gives the feel of no fill colour
				Constants.DEFAULT_TEXT_COLOUR);
	}
	
	/**
	 * Set the name for this objects place holder
	 * @param newPlaceholder
	 */
	public void setPlaceholder(String newPlaceholder){
		this.placeholder = newPlaceholder;
	}
	
	/**
	 * Returns the place holder for this object
	 * @return 
	 */
	public String getPlaceholder(){
		return this.placeholder;
	}

	
	
	@Override
	public boolean checkBounds(int x, int y) {
		if(x >= (this.x - 4) 
				&& x <= (this.x + this.width + 4) 
				&& y >= (this.y - 4)
				&& y <= (this.y + this.height + 4)){
			return true;
		}

		return false;
	}

	@Override
	public void updateResizePoints() {
		this.resizeX = (getX() + getWidth()) + 1;
		this.resizeY = (getY() + getHeight()) + 1;
	}

	@Override
	public int getWidth() {
		return width;
	}

	@Override
	public int getHeight() {
		return height;
	}

	@Override
	public void setWidth(int width) {
		this.width = width;
		updateResizePoints();
	}

	@Override
	public void setHeight(int height) {
		this.height = height;
		updateResizePoints();

	}

	/**
	 * Sets whether a box can be resized
	 * @param resize if the box is being resized this is set to true
	 */
	public void setResize(boolean resize){
		isResizing = resize;
	}

	/**
	 * Checks whether a box object can be resized
	 * @return if the box can resize, returns true, if not, returns false
	 */
	public boolean isResizing(){
		return isResizing;
	}
	
	

}
